<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <canvas id="cont" width="1000px" , height="1000px"></canvas>
  <script>
    var canvas = document.querySelector('#cont')
    var ctx = canvas.getContext('2d')

    ctx.fillStyle = "red";
    ctx.save();
    ctx.translate(100, 100);
    ctx.rotate(Math.PI / 180 * 60);
    ctx.fillStyle = "blue";
    ctx.fillRect(0, 0, 100, 100);
    ctx.restore();
    ctx.save();
    ctx.translate(0, 0);
    ctx.fillRect(0, 0, 50, 50)
    ctx.restore();
    ctx.stroke()
  </script>
</body>

</html>